import {
  mapState,
  mapActions
} from 'vuex';
export default {
  data() {
    return {
      share: {
        title: '酒华仕联营橱窗',
        path: '/pages/index/index',
      },
      distribution_code: null,
    }
  },
  computed: {
    ...mapState('user', {
      userInfo: 'userInfo',
    }),
  },
  //分享好友
  onShareAppMessage(res) {
    console.log(res);
    console.log(this.userInfo);
    return {
      title: this.share.title,
      path: this.share.path + '?distribution_code=' + this.userInfo.distribution_code,
      success(res) {
        uni.showToast({
          title: '分享成功'
        })
      },
      fail(res) {
        uni.showToast({
          title: '分享失败'
        })
      }
    }
  },
  //分享到朋友圈
  onShareTimeline(res) {
    console.log(res);
    return {
      title: this.share.title,
      path: this.share.path + '?distribution_code=' + this.userInfo.distribution_code,
      success(res) {
        uni.showToast({
          title: '分享成功'
        })
      },
      fail(res) {
        uni.showToast({
          title: '分享失败'
        })
      }
    }
  }
}